<script type="text/javascript">
var _orig_goods_amount = {$order.goods_amount},
    _orig_shipping_fee = {$shipping.shipping_fee},
    _orig_order_amount = {$order.order_amount};
$(function(){
    $('#goods_amount_input').keyup(function(){
        recount_order_amount();
    });
    $('#shipping_fee_input').keyup(function(){
        recount_order_amount();
    });
    $('#discount_input').keyup(function(){
        recount_order_amount();
    });
    $('#cancel_button').click(function(){
        DialogManager.close('seller_order_adjust_fee');
    });
    $('#free_shipping_input').click(function(){
        if(($(this).is(':checked')) === true){
            $('#seller_free_shipping_input').attr('checked', false);
            $('#shipping_fee_input').val('0.00');
        }else{
            $('#shipping_fee_input').val($(this).val());
        }
        recount_order_amount();
    });
});
function recount_order_amount(){
    var order_amount = 0;
    var discount = 0;
    order_amount = Number($('#goods_amount_input').val()) + Number($('#shipping_fee_input').val());
    if(($('#discount_input').val() !== undefined)){
        discount = Number($('#discount_input').val());
    }
    $('#order_amount').html(price_format(order_amount - discount));
}
</script>
<style type="text/css">
.ajax_form_block { border-bottom:#dadada 1px dotted; padding-bottom:15px; padding-top:15px; }
</style>
<ul class="tab f-cb">
    <li class="active">{$lang.adjust_fee}</li>
</ul>
<div class="eject_con eject_con_ga">
    <form  method="post" target="seller_order" action="index.php?app=seller_order&act=adjust_fee&order_id={$order.order_id}&ajax">
        <div class="content_line f-cb">
            <div id="warning"></div>
            {$lang.buyer_name}:&nbsp;&nbsp;{$order.buyer_name|escape}
            <br />
            {$lang.order_sn}&nbsp;&nbsp;: <strong class="color8">{$order.order_sn}</strong>
        </div>
        <div class="content_line f-cb">
            <ul class="foll_in">
                <li class="f-cb">
                    <h3>
                        {$lang.goods_amount}: <strong class="color8">{$order.goods_amount|price}</strong>
                    </h3>
                    <p>
                        <input type="text" id="goods_amount_input" class="text width13" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" {if $smarty.session.user_token_id}readonly="true"{/if} name="goods_amount" value="{$order.goods_amount}"/>
                    </p>
                </li>
                <li class="f-cb">
                    <h3>
                        {$lang.shipping_fee}:
                        <strong class="color8">{$shipping.shipping_fee|price}</strong>
                    </h3>
                    <p>
                        <input type="text" id="shipping_fee_input" class="text width13" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" name="shipping_fee" value="{if $shipping.free_shipping gt 0}0.00{else}{$shipping.shipping_fee}{/if}" />
                    </p>
                </li>
                <!--{if $smarty.session.user_token_id}-->
                <li class="f-cb">
                    <h3>平台优惠:</h3>
                    <p>
                        <input type="text" id="discount_input" class="text width13" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d.]/g,''))" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" name="discount" value="{$order.discount}" />
                    </p>
                </li>
                <li class="f-cb">
                    <h3>免邮:</h3>
                    <p>
                        <input type="checkbox" id="free_shipping_input" name="free_shipping" {if $shipping.free_shipping gt 0}checked{/if} value="{if $shipping.free_shipping gt 0}{$shipping.free_shipping}{else}{$shipping.shipping_fee}{/if}" />
                        <label for="free_shipping_input">设为平台包邮(邮费由万菱支付)</label>
                    </p>
                </li>
                <!--{/if}--> 
            </ul>
            <p class="explain">{$lang.adjust_fee_notice}</p>
        </div>
        <div class="total_value">
            <h3>
                {$lang.order_amount}:
                <strong class="color8" id="order_amount">{$order.order_amount|price}</strong>
            </h3>
        </div>
        <div class="wrap_btn">
            <input type="submit" id="confirm_button" class="btn1" value="{$lang.confirm}" />
            <input type="button" id="cancel_button" class="btn2" value="{$lang.cancel}" />
        </div>
    </form>
</div>